package models

import (
	"iris_test/config"
	"tyz/orm/mongo"
	"gopkg.in/mgo.v2/bson"
)
type Models struct {
	Dbname     string
	Tbname     string
	Conn *mongo.Model
}
func(siteSet *Models)FindOne(query bson.M)*bson.M {
	return siteSet.Conn.FindOne(query)
}

func (siteSet *Models)InitConn()*Models {
	siteSet.Conn = new(mongo.Model).Init(siteSet.Dbname, siteSet.Tbname, config.GetSession())
	return siteSet
}

func (siteSet *Models)Close() {
	if siteSet.Conn != nil {
		siteSet.Conn.Close()
	}
}
